package com.nothingboard.module.board.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.nothingboard.module.board.dao.BoardDao;
import com.nothingboard.module.board.model.BoardSearchDto;
import com.nothingboard.module.board.model.BoardVo;

public class BoardDaoImpl extends SqlMapClientDaoSupport implements BoardDao{
	
	@Resource(name="sqlMapClient")
	public void setSuperSqlMapClient(SqlMapClient sqlMapClient){
		super.setSqlMapClient(sqlMapClient);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Object> getBoardList(BoardSearchDto dto) throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("board.getBoardList", dto);
	}
	
	@Override
	public Object get(long boardNo) throws DataAccessException {
		return getSqlMapClientTemplate().queryForObject("board.getBoard", boardNo);
	}
	
	@Override
	public Object insert(BoardVo vo) throws DataAccessException {
		return getSqlMapClientTemplate().insert("board.insertBoard", vo);
	}

	@Override
	public long getCount(BoardSearchDto dto) throws DataAccessException {
		return 0;
	}
	
	@Override
	public int update(BoardVo vo) throws DataAccessException {
		return 0;
	}

	@Override
	public int delete(BoardVo vo) throws DataAccessException {
		return 0;
	}

	
}
